package com.hello.sandbox.fake.service;

import black.android.net.BRIVpnManagerStub;
import black.android.os.BRServiceManager;
import com.hello.sandbox.fake.hook.BinderInvocationStub;
import com.hello.sandbox.fake.hook.ScanClass;

/** Created by Milk on 4/12/21. * ∧＿∧ (`･ω･∥ 丶　つ０ しーＪ 此处无Bug */
@ScanClass(VpnCommonProxy.class)
public class IVpnManagerProxy extends BinderInvocationStub {
  public static final String TAG = "IVpnManagerProxy";
  public static final String VPN_MANAGEMENT_SERVICE = "vpn_management";

  public IVpnManagerProxy() {
    super(BRServiceManager.get().getService(VPN_MANAGEMENT_SERVICE));
  }

  @Override
  protected Object getWho() {
    return BRIVpnManagerStub.get()
        .asInterface(BRServiceManager.get().getService(VPN_MANAGEMENT_SERVICE));
  }

  @Override
  protected void inject(Object baseInvocation, Object proxyInvocation) {
    replaceSystemService(VPN_MANAGEMENT_SERVICE);
  }

  @Override
  public boolean isBadEnv() {
    return false;
  }
}
